import upload from '@/utils/upload'
import request from '@/utils/request'


export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params: data
  })
}


export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}


export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}


export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}



export function addMerchant(data) {
  return request({
    url: '/system/user/addMerchant',
    method: 'post',
    data: data
  })
}

export function addPartner(data) {
  return request({
    url: '/system/user/addPartner',
    method: 'post',
    data: data
  })
}




export function getUserPageList(query) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params: query
  })
}

export function getList(query) {
  return request({
    url: '/system/user/getList',
    method: 'get',
    params: query
  })
}


export function deleteUserByIds(userId) {
  return request({
    url: '/system/user/'+userId,
    method: 'delete'
  })
}




export function updateUser(data) {
  return request({
    url: '/system/user/',
    method: 'put',
	data:data
	
  })
}
